/*
 *  stdio.c
 *  xD-OS
 *
 *  Created by James Johns on 22/07/2009.
 *  Copyright 2009 xD-Dunce. All rights reserved.
 *
 */

#include "stdio.h"


Byte inB(Word Port){
	Byte ret;
	asm volatile("inb %1, %0" : "=a" (ret) : "dN" (Port) );
	return ret;
}

Word inW(Word Port){
	Word ret;
	asm volatile("inw %1, %0" : "=a" (ret) : "dN" (Port) );
	return ret;
}


void outB(Word Port, Byte value){
	asm volatile("outb %1, %0" :: "dN"(Port), "a"(value));
}

void outW(Word Port, Word value){
	asm volatile("outw %1, %0" :: "dN"(Port), "a"(value));
}

dWord strlen(Byte *string){
	int i = 0;
	while(string[i] != 0x00)
		i++;
	return i;
}


